package pl.ptemich.eav.engine.render.impl;

import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;

import pl.ptemich.eav.constants.WorldLimits;
import pl.ptemich.eav.engine.physics.StaticObject;
import pl.ptemich.eav.engine.render.RenderOptions;
import pl.ptemich.eav.engine.render.Renderer;

public class BaseRenderer implements Renderer {

  private Image image;
  
  public BaseRenderer(Image image) {
    this.image = image;
  }
  
  @Override
  public void render(RenderOptions options, StaticObject physics) {
    Graphics graphics = options.getGraphics();
    graphics.drawImage(image, physics.getBoxL() , WorldLimits.SCREEN_HEIGHT - physics.getBoxU());
    if (WorldLimits.DRAW_BOXES) {
      graphics.drawRect(physics.getBoxL() , WorldLimits.SCREEN_HEIGHT - physics.getBoxU(), 
                        physics.getBoxR() - physics.getBoxL(), 
                        physics.getBoxU() - physics.getBoxD());
    }
  }

}
